package com.jucai.pppeiyouclient.utils;

import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.TranslateAnimation;

@SuppressWarnings("ALL")
public class AnimUtil {

    private static int DEFAULT_TIME = 1000;
    private static float DEFAULT_HEIGHT = 600f;

    public static void showAlpha(View view) {

        AlphaAnimation alphaAnimation = new AlphaAnimation(0.1f, 1.0f);
        alphaAnimation.setDuration(DEFAULT_TIME);
        view.startAnimation(alphaAnimation);

    }

    public static void showAlpha(View view, int time) {

        AlphaAnimation alphaAnimation = new AlphaAnimation(0.1f, 1.0f);
        alphaAnimation.setDuration(time);
        view.startAnimation(alphaAnimation);

    }

    public static void goneAlpha(View view) {

        AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
        alphaAnimation.setDuration(DEFAULT_TIME);
        view.startAnimation(alphaAnimation);

    }

    public static void goneAlpha(View view, int time) {

        AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
        alphaAnimation.setDuration(time);
        view.startAnimation(alphaAnimation);

    }

    public static void upTranslate(View view) {

        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, DEFAULT_HEIGHT, 0.0f);
        translateAnimation.setDuration(DEFAULT_TIME);
        view.startAnimation(translateAnimation);

    }

    public static void upTranslate(View view, int time) {

        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, DEFAULT_HEIGHT, 0.0f);
        translateAnimation.setDuration(time);
        view.startAnimation(translateAnimation);

    }

    public static void upTranslate(View view, float y) {

        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, y, 0.0f);
        translateAnimation.setDuration(DEFAULT_TIME);
        view.startAnimation(translateAnimation);

    }

    public static void upTranslate(View view, int time, float y) {

        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, y, 0.0f);
        translateAnimation.setDuration(time);
        view.startAnimation(translateAnimation);

    }

    public static void downTranslate(View view) {

        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, 0.0f, DEFAULT_HEIGHT);
        translateAnimation.setDuration(DEFAULT_TIME);
        view.startAnimation(translateAnimation);

    }

    public static void downTranslate(View view, int time) {

        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, 0.0f, DEFAULT_HEIGHT);
        translateAnimation.setDuration(time);
        view.startAnimation(translateAnimation);

    }

    public static void downTranslate(View view, float y) {

        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, 0.0f, y);
        translateAnimation.setDuration(DEFAULT_TIME);
        view.startAnimation(translateAnimation);

    }

    public static void downTranslate(View view, int time, float y) {

        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, 0.0f, y);
        translateAnimation.setDuration(time);
        view.startAnimation(translateAnimation);

    }

    public static void leftTranslate(View view) {

        TranslateAnimation translateAnimation = new TranslateAnimation(DEFAULT_HEIGHT, 0.0f, 0.0f, 0.0f);
        translateAnimation.setDuration(DEFAULT_TIME);
        view.startAnimation(translateAnimation);

    }

    public static void leftTranslate(View view, int time) {

        TranslateAnimation translateAnimation = new TranslateAnimation(DEFAULT_HEIGHT, 0.0f, 0.0f, 0.0f);
        translateAnimation.setDuration(time);
        view.startAnimation(translateAnimation);

    }

    public static void leftTranslate(View view, float x) {

        TranslateAnimation translateAnimation = new TranslateAnimation(x, 0.0f, 0.0f, 0.0f);
        translateAnimation.setDuration(DEFAULT_TIME);
        view.startAnimation(translateAnimation);

    }

    public static void leftTranslate(View view, int time, float x) {

        TranslateAnimation translateAnimation = new TranslateAnimation(x, 0.0f, 0.0f, 0.0f);
        translateAnimation.setDuration(time);
        view.startAnimation(translateAnimation);

    }

    public static void rightTranslate(View view) {

        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, DEFAULT_HEIGHT, 0.0f, 0.0f);
        translateAnimation.setDuration(DEFAULT_TIME);
        view.startAnimation(translateAnimation);

    }

    public static void rightTranslate(View view, int time) {

        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, DEFAULT_HEIGHT, 0.0f, 0.0f);
        translateAnimation.setDuration(time);
        view.startAnimation(translateAnimation);

    }

    public static void rightTranslate(View view, float x) {

        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, x, 0.0f, 0.0f);
        translateAnimation.setDuration(DEFAULT_TIME);
        view.startAnimation(translateAnimation);

    }

    public static void rightTranslate(View view, int time, float x) {

        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, x, 0.0f, 0.0f);
        translateAnimation.setDuration(time);
        view.startAnimation(translateAnimation);

    }

}
